/**
 * Copyright &copy; 2019-2022 <a href="https://gitee.com/rit/zx-pm">zx-pm</a> All rights reserved.
 */
package com.zx.pm.modules.zx.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zx.pm.common.persistence.Page;
import com.zx.pm.common.service.CrudService;
import com.zx.pm.common.utils.DateUtils;
import com.zx.pm.modules.zx.entity.YwLog;
import com.zx.pm.modules.zx.dao.YwLogDao;

/**
 * 业务日志Service
 * @author forest
 * @version 2019-01-30
 */
@Service
@Transactional(readOnly = true)
public class YwLogService extends CrudService<YwLogDao, YwLog> {

	public YwLog get(String id) {
		return super.get(id);
	}
	
	public List<YwLog> findList(YwLog ywLog) {
		return super.findList(ywLog);
	}
	
	public Page<YwLog> findPage(Page<YwLog> page, YwLog ywLog) {
		// 设置默认时间范围，默认当前月
		if (ywLog.getBeginDate() == null){
			ywLog.setBeginDate(DateUtils.setDays(DateUtils.parseDate(DateUtils.getDate()), 1));
		}
		if (ywLog.getEndDate() == null){
			ywLog.setEndDate(DateUtils.addMonths(ywLog.getBeginDate(), 1));
		}
		return super.findPage(page, ywLog);
	}
	
	@Transactional(readOnly = false)
	public void save(YwLog ywLog) {
		super.save(ywLog);
	}
	
	@Transactional(readOnly = false)
	public void delete(YwLog ywLog) {
		super.delete(ywLog);
	}
	
}